<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<sec:authentication property="principal" var="currentPrincipal" scope="page"/>

<fmt:setBundle basename="ApplicationMessage"/>
<fmt:setLocale value="zh_CN"/>

<!DOCTYPE html>
<html lang="zh-CN">
<head>

    <%@ include file="/WEB-INF/include/meta.jsp" %>
    <%@ include file="/WEB-INF/include/css.jsp" %>

</head>

<body class="ms-theme-blue">

	<%@ include file="/WEB-INF/include/header.jsp" %>
	<%@ include file="/WEB-INF/include/submenu.jsp" %>
	
	<div class="container-fluid ms-container has-ms-sidemenu">
  
    <ol class="ms-breadcrumb breadcrumb">
        <li class="active">考核结果查询</li>
    </ol>

    <div class="ms-content-layout">
    
      <div class="ms-operation-bar no-margin no-bottom-border clearfix">
        <div class="ms-operation-group pull-right">
          <a href="${ctx.host}/appraisal-results/search" data-target="#search" data-toggle="modal" class="btn ms-btn ms-btn-blue">
             <i class="glyphicon glyphicon-search"></i>&nbsp;&nbsp;过滤查询
          </a>
        </div>
      </div>

      <table class="table table-hover ms-table">
        <thead>
          <tr>
            <th>序号</th>
            <th>考核名称</th>
            <th>考核标准</th>
            <th>考核类型</th>
            <th>公司类型</th>
            <th>考核对象</th>
            <th>考核时间</th>
            <th>考核进度</th>
            <td>评分人</td>
          </tr>
        </thead>

        <tbody>
          <c:forEach items="${appraisalResults}" var="result" varStatus="status">
            <tr>
              <td>${status.count}</td>
              <td>${result.appraisal.name}</td>
              <td>${result.appraisal.template.name}</td>
              <td>${result.appraisalType.description}</td>
              <td>${result.appraisal.target.description}</td>
              <td>${result.code}&nbsp;-&nbsp;${result.name}</td>
              <td><fmt:formatDate value="${result.appraisal.beginDate}" pattern="yyyy/MM/dd"/>&nbsp;-&nbsp;<fmt:formatDate value="${result.appraisal.endDate}" pattern="yyyy/MM/dd"/></td>
              <td>
                <c:if test="${appraisalResultItemMaps.containsKey(result.idString)}">
                  <dl style="margin-bottom: 2px;">
                    <c:forEach items="${appraisalResultItemMaps[result.idString]}" var="appraisalResultItem">
                      <c:choose>
                        <c:when test="${empty appraisalResultItem.realScore}"><dd>${appraisalResultItem.name}：&nbsp;&nbsp;未考核</dd></c:when>
                        <c:otherwise> <dd>${appraisalResultItem.name}：&nbsp;&nbsp;<span class="color-red">${appraisalResultItem.realScore}</span>/${appraisalResultItem.score}</dd></c:otherwise>
                      </c:choose>
                    </c:forEach>
                  </dl>
                </c:if>
              </td>
              <td>${persist.user(result.rater).loginName}</td>
            </tr>
          </c:forEach>
        </tbody>

        <tfoot>
          <tr>
              <td colspan="9" class="no-vertical-padding">
                  <div class="pull-left">
                      <jsp:include page="/WEB-INF/include/page.jsp">
                          <jsp:param name="url" value="appraisal-results"/>
                          <jsp:param name="queryString" value="${queryString}"/>
                      </jsp:include>
                  </div>
              </td>
          </tr>
        </tfoot>
      </table>

    </div>
  </div>

  <%@ include file="/WEB-INF/include/script.jsp" %>
  <d:resource type="script" root="${ctx.resource}/build" src="js/page/supplier/performance/appraisal-result/appraisal-result-list.js"/>
  <script type="text/javascript">
    require(['page/supplier/performance/appraisal-result/appraisal-result-list'], function (page) {
      page.init()
    })
  </script>

</body>
</html>
